namespace Hack.Decompiling.PEA.CLR
{
  using System;
  using System.IO;
  using System.Collections.Generic;
  using System.Text;
  using PEA.PE;

  public class MetadataHeader
  {
    #region Consts
    public static UInt32 SignatureValue = 0x424A5342; //BSJB
    public static UInt16 DefaultMajorVersion = 2;
    public static UInt16 DefaultMinorVersion = 0;
    public static UInt16 DefaultStreamCount = 5;
    #endregion
    #region Fields
    protected UInt32 _Signature = SignatureValue;
    protected UInt16 _MajorVersion = DefaultMajorVersion;
    protected UInt16 _MinorVersion = DefaultMinorVersion;
    protected UInt32 _Reserved = 0;
    protected UInt32 _Flags = 0;
    /// <summary>
    /// Use string instead of length/varible chars.
    /// 4 Bytes Length + chars *
    /// </summary>
    protected string _Version = string.Empty;
    protected IList<StreamHeader> streamHeaders = null;
    #endregion
    #region Properties
    public virtual UInt32 Signature
    {
      get { return _Signature; }
      set { _Signature = value; }
    }
    public virtual UInt16 MajorVersion
    {
      get { return _MajorVersion; }
      set { _MajorVersion = value; }
    }
    public virtual UInt16 MinorVersion
    {
      get { return _MinorVersion; }
      set { _MinorVersion = value; }
    }
    public virtual UInt32 Reserved
    {
      get { return _Reserved; }
      set { _Reserved = value; }
    }
    public virtual string Version
    {
      get
      {
        return this._Version;
      }
      set
      {
        this._Version = value;
      }
    }
    public virtual UInt32 Flags
    {
      get { return _Flags; }
      set { _Flags = value; }
    }
    public virtual IList<StreamHeader> StreamHeaders
    {
      get
      {
        return this.streamHeaders == null ?
          this.streamHeaders = new List<StreamHeader>() :
          this.streamHeaders;
      }
    }
    #endregion
    #region Methods
    public virtual void Read(BinaryReader reader)
    {
    }
    #endregion
  }
}
